<template>
  <div class="fullscreen flex justify-center align-center">
    <Bg :isFix="true" :bgParams="bgParams"></Bg>
    <div class="userinfo flex-direction justify-center">
      <div class="header">
        <a href="#">
          <img :src="avatar" />
        </a>
      </div>
      <div class="quotes">
        <p v-html="quotes"></p>
      </div>
      <!-- 功能列表 -->
      <div class="icons flex justify-center">
        <ul>
          <li v-for="(item, index) in icons" :key="index">
            <a target="_blank" :href="item.src"><img :src="item.pic" /></a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { getInfo } from "@/apiv/config";
export default {
  data() {
    return {
      bgParams: {
        height: 100,
        bgimg: "",
      },
      avatar: "",
      quotes: "",
      // logo: "",
      icons: [
        {
          name: "qq",
          src: "tencent://message/?uin=",
          pic:
            "https://gitee.com/lovestarboy/figurebed/raw/master/image/qq.png",
        },
        {
          name: "github",
          src: "https://gitee.com/",
          pic:
            "https://gitee.com/lovestarboy/figurebed/raw/master/image/github.png",
        },
        {
          name: "wangyi",
          src: "https://music.163.com/#/user/home?id=",
          pic:
            "https://gitee.com/lovestarboy/figurebed/raw/master/image/wangyi.png",
        },
        {
          name: "bilibili",
          src: "https://space.bilibili.com/",
          pic:
            "https://gitee.com/lovestarboy/figurebed/raw/master/image/bilibili.png",
        },
      ],
    };
  },
  mounted() {
    this.handleLoad();
  },
  methods: {
    handleLoad() {
      // 初始化
      getInfo().then((res) => {
        let {
          bgimg,
          avatar,
          quotes,
          qq,
          netease_cloud,
          gitee,
          bilibili,
        } = res.data;
        this.bgParams.bgimg = bgimg;
        this.avatar = avatar;
        this.quotes = quotes;
        let apps = [qq, gitee, netease_cloud, bilibili];
        let icons = this.icons.map((current, index) => {
          let item = current;
          item.src = item.src + apps[index];
          return item;
        });
        this.icons = icons;
      });
    },
  },
};
</script>
<style lang='scss' scoped>
.fullscreen {
  width: 100%;
  height: 100vh;
  .userinfo {
    width: 504px;
    color: white;
    .header {
      margin: auto;
    }
    .header img {
      width: 130px;
      height: 130px;
      border-radius: 50%;
      overflow: hidden;
      // box-shadow: inset 0 0 10px #000;
      box-shadow: inset 1px 1px 1px #e0d8c3, inset -1px -1px 1px #ffffff;
      padding: 5px;
      opacity: 1;
      transition: all 1s;
    }
    .header img:hover {
      transform: rotate(360deg);
    }
    .quotes {
      box-sizing: border-box;
      width: 100%;
      font-size: 16px;
      text-align: center;
      border-radius: 20px;
      color: #000;
      color: #ffffff;
      background-color: rgba($color: #f0ede6, $alpha: 0.3);
      box-shadow: inset 1px 1px 1px #e0d8c3, inset -1px -1px 1px #ffffff;
      padding: 15px;
      margin: 30px 0;
    }
    .quotes p {
      font-weight: 700;
      line-height: 2em;
    }
    .icons ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
      display: flex;
    }
    .icons ul li + li {
      margin-left: 10px;
    }
    .icons img {
      width: 35px;
      height: 35px;
      padding: 6px;
      box-sizing: border-box;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.2);
      box-shadow: inset 1px 1px 1px #e0d8c3, inset -1px -1px 1px #ffffff;
      &:hover {
        background: rgba(255, 255, 255, 0.6);
      }
    }
  }
}
</style>